#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QColorDialog>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QColorDialog* colorDialog = new QColorDialog(this);
    QColor color = colorDialog->getColor();
    qDebug()<<color;
//    this->setStyleSheet(QString("background-color:rgb(")+QString::number(color.red())+","+
//                        QString::number(color.green())+","+QString::number(color.blue())+");");
    char style[1024] = {0};
    sprintf(style,"background-color:rgb(%d,%d,%d);",color.red(),color.green(),color.blue());
    this->setStyleSheet(style);

}
